package org.liubility.server.usersys.controller;

import com.jdragon.common.response.normal.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.liubility.pojo.exception.LBException;
import org.liubility.server.usersys.entity.User;
import org.liubility.server.usersys.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: Jdragon
 * @email: 1061917196@qq.com
 * @Date: 2020.09.04 15:49
 * @Description:
 */
@RestController
@RequestMapping("/user")
@Api(tags = "用户")
public class UserController {

    @Autowired
    UserService userService;

    @PostMapping("/register")
    @ApiOperation("注册")
    public Result<User> register(@RequestBody User user) throws LBException {
        return Result.success(userService.register(user));
    }

    @PostMapping("/test")
    @ApiOperation("测试")
    public Result<Boolean> isLogin(){
        return Result.success(true);
    }
}
